<%@ page import="yc.day0109.travelt.dao.TourRouteDao" %>
<%@ page import="yc.day0109.travelt.dao.impl.TourRouteDaoImpl" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="yc.day0109.travelt.po.TourRoute" %>
<%@ page import="yc.day0109.travelt.constants.TourRouteType" %><%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2023/1/9
  Time: 20:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta charset="utf-8">
  <title>青游旅行社服务平台</title>
  <link rel="stylesheet" href="../../../css/yc/day0110/travel-services.css">
<%--  <script src="js/jquery-3.6.3.js"></script>--%>
<%--  <script src="js/add-information.js"></script>--%>
  <%
    TourRouteDao tourRouteDao = new TourRouteDaoImpl();
    Map<String,Object> map = new HashMap<>();
    String searchName = request.getAttribute("searchName") == null ? "" :
            String.valueOf(request.getAttribute("searchName"));
    if(!"".equals(searchName)){
      map.put("trname",searchName);
    }
    List<TourRoute> tourRouteList = tourRouteDao.queryTourRoute(map);
  %>
</head>
<body>
<div id="container">
  <header>青游旅行社服务平台</header>
  <div id="main_body">
    <div id="main_center">
      <form>
        <div id="search">
          <!-- <button name="btnSeach" id="ch"><a href="add-information.html">添加</a></button> -->
          <a href="add-information.jsp"><input type="button" value="添加"></a>
        </div>
        <table>
          <thead>
          <tr>
            <th>旅行线路名称</th>
            <th>类型</th>
            <th>价格(元)</th>
            <th>咨询电话</th>
            <th>咨询人</th>
            <th>创建日期</th>
            <th>操作</th>
          </tr>
          <%
            for (int i = 0; i < tourRouteList.size(); i++) {
          %>
          <tr>
            <td><%=tourRouteList.get(i).getTrname()%></td>
            <td><%=TourRouteType.getTourRouteTypeByCode(tourRouteList.get(i).getTrType()).getValue()%></td>
            <td><%=tourRouteList.get(i).getTrPrice()%></td>
            <td><%=tourRouteList.get(i).getTrPhone()%></td>
            <td><%=tourRouteList.get(i).getTrUser()%></td>
            <td><%=tourRouteList.get(i).getCreateTime()%></td>
            <td><a href="">详情</a>&nbsp;<a href="">删除</a></td>
          </tr>

          <%}%>
          </thead>
          <tbody>

          </tbody>
        </table>
      </form>
    </div>
  </div>
</div>
</body>
</html>
